#ifndef MSGSTRUCT_H_
#define MSGSTRUCT_H_


#include "globlvar.h"


// here are modules name, use them in packet_t.who

#define DATABASE 1
#define AIRPORT 2
#define AIRPLANE 3
#define AI 4
#define WEATHER 5
#define GUI 10

// operations connected with GUI
#define GUI_WANT_AIRPORT_DATA 1
#define GUI_WANT_AIRCRAFT_DATA 2
#define GUI_WANT_RUNWAY_DATA 3
#define GUI_SEND_CONTROL_DATA 4

// operations connected with AI
#define AI_WANT_AIRPORT_DATA 1
#define AI_WANT_AIRCRAFT_DATA 2
#define AI_WANT_RUNWAY_DATA 3
#define AI_SEND_AIRCRAFT_DATA 4

// operations connected with AIRPORT
#define AIRPORT_WANT_PUT_ITS_DATA 1

#define COMMAND_OK 255




typedef struct
{
    int type;
    char airportName[50];
    int X;
    int Y;
    int Range;
    int Capacity;
    int RunwaysNumber;
    int State;
} airport;

typedef struct
{
    int runwayID;
    bool isOccupied;
    char occupyName[20];
} runway;

typedef struct
{
    int noOfRunways;
    runway r[MAX_RUNWAYS_IN_AIRPORT];
} runwayList;

typedef struct
{
	char name[30];
	int x;
	int y;
	int capacity;
	int z;
} msgInit;

typedef struct
{
    char aircraftName[20];
    int aircraftID;
    int Xposition;
    int Yposition;
    int state;
    int FuelValue;
} aircraft;

typedef struct {
	int samolot_typ_id;
	int zasieg_max;
	int bak_max; /* pojemnosc baku */
	int pasazerowie_max;
	int dlugosc_pasa; /* wymagana dlugosc pasa */
	int czas_startu;
	int czas_ladowania;
	int predkosc_max;
	char nazwa[50]; /* nazwa samolotu */
} samolot_typ_t;



typedef struct
{
    int type; // type of message, maybe useful, maybe completely useless
    int noOfAircrafts; // how much aircrafts is in range and should be send to GUI
    aircraft a[MAX_PLANES_IN_RANGE];
} aircraftList;


typedef struct
{
	int dummy;
} msgDummy;


typedef struct
{
    //struct _pulse hdr;
    int who;
    int type;
    union
    {
	airport		 	lotnisko;
	aircraftList		listaSamolotow;	
	runwayList		listaPasow;
	aircraft			samolot;
	samolot_typ_t 	samolot_typ;
    };
} packet_t;








#endif /* MSGSTRUCT_H */ 
